package com.usian.wemedia.controller;

import com.usian.api.wemedia.WmUserControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.dtos.WmUserDto;
import com.usian.model.media.pojos.WmUser;
import com.usian.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/user")
public class WmUserController implements WmUserControllerApi {
    @Autowired
    private WmUserService wmUserService;

    //创建自媒体账户
    @PostMapping("save")
    @Override
    public ResponseResult add(@RequestBody WmUser wmUser) {
        return wmUserService.add(wmUser);
    }

    //根据自媒体用户名查询账户
    @GetMapping("/findByName/{name}")
    @Override
    public WmUser findByName(@PathVariable String name) {
        return wmUserService.findByName(name);
    }


}
